<template>
  <div id="vue-medical" ref="container">
    <router-view v-if="isRouterAlive"/>
  </div>
</template>

<script>
  import watermark from '@/utils/waterMarker'

  
  export default {
    name: 'App',
    data () {
      return {
        isRouterAlive: true,
        // options: {
        //   content: localStorage.getItem('loginUserName')
        // }
      }
    },

    watch: {
      $route:{
        handler(val,oldval){
          var contentValue = localStorage.getItem('loginUserName');
          if (contentValue == null || contentValue == undefined || contentValue == "") {
            contentValue = ''
          }
          const options ={
            content: contentValue
          }
          watermark(options)
        },
        // 深度观察监听
        deep: true
      }
    },
    mounted: function () {
      // var contentValue = localStorage.getItem('loginUserName');
      // if (contentValue == null || contentValue == undefined || contentValue == "") {
      //   contentValue = ''
      // }
      // const options ={
      //   content: contentValue
      // }
      // watermark(options)
    },

    methods: {
      reload () {
        this.isRouterAlive = false
        this.$nextTick(() => (this.isRouterAlive = true))
      },
    }

  }
</script>
